home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: Creating New Frames in ODF with Request EmbeddedFrame
- Sent: 4/17/96 3:54 PM
- Received: 4/17/96 4:11 PM
- From: Henri Lamiraux, lamiraux@apple.com
- Reply-To: ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- >How come I don't get a new frame with this? TempFrame turns up empty and my
- >parts NewFrame never gets called. Clearly something is wrong and I have no
- >doubt it is something rather simple, if someone could give me a hand I
- >would greatly appreciate it.
- >
- >void CDataAndMoviePart::NewMovieFrame( Environment *ev, CMovieFrame
- >*RefFrame )
- >{
- > FW_CRect frameRect = RefFrame->GetBounds( ev );
- > FW_CRect contentRect(frameRect);
- >
- > contentRect.Place( FW_kZeroPoint);
- >
- > contentRect.top = frameRect.bottom + FW_IntToFixed(0);
- > contentRect.bottom = contentRect.top + FW_IntToFixed(50);
- >
- > ODSession *session = GetSession(ev);
- > ODFrame *ContainingFrame =
- >RefFrame->AcquireContainingFrame(ev);
- > ODPart *ContainingPart = ContainingFrame->AcquirePart(ev);
- > ODFrame *tempFrame;
- >
- > tempFrame = ContainingPart->RequestEmbeddedFrame(
- > ev,
- > ContainingFrame,
- > RefFrame->GetODFrame(ev),
- > ::FW_NewODShape( ev, contentRect ),
- > GetODPart(ev),
- > gViewAsFrameToken,
- > session->Tokenize(ev,kDebugPresentation),
- > FALSE );
- >}
- >
- >Jer,
-
- Look at my previous message on why this does work.
-
- Just a note about reference counting. Be very careful in OpenDoc, objects
- like ODShape and ODTransform, ODFrame etc.. are reference counted. So
- lines like:
-
- > ODFrame *ContainingFrame =
- >RefFrame->AcquireContainingFrame(ev);
- > ODPart *ContainingPart = ContainingFrame->AcquirePart(ev);
- > ODFrame *tempFrame;
- >
- > tempFrame = ContainingPart->RequestEmbeddedFrame(
- > ev,
- > ContainingFrame,
- > RefFrame->GetODFrame(ev),
- > ::FW_NewODShape( ev, contentRect ),
- > GetODPart(ev),
- > gViewAsFrameToken,
- > session->Tokenize(ev,kDebugPresentation),
- > FALSE );
-
- should be
-
- FW_CAcquiredODFrame ContainingFrame =
- RefFrame->AcquireContainingFrame(ev);
- FW_CAcquiredODPart ContainingPart =
- ContainingFrame->AcquirePart(ev);
-
- FW_AcquiredODShape frameShape = ::FW_NewODShape( ev, contentRect
- ),
- FW_CAcquiredODFrame tempFrame =
- ContainingPart->RequestEmbeddedFrame(
- ev,
- ContainingFrame,
- RefFrame->GetODFrame(ev),
- frameShape,
- GetODPart(ev),
- gViewAsFrameToken,
- session->Tokenize(ev,kDebugPresentation),
- FALSE );
-
- When calling OpenDoc or ODF methods starting with Acquire (like
- AcquireContainingFrame) you should use a FW_CAcquiredODXXXX object. Same
- thing when creating refcounted objects (like FW_NewODShape) Not doing
- that will generate memory leaks or crashes. You should also use the
- OpenDoc debug version. This version will warn you about refcounting
- problems.
-
- .......................................................................
- Henri Lamiraux lamiraux@apple.com
- Apple Computer, Inc. OpenDoc(tm) Development Framework
- .......................................................................
-
-
-